package net.wanho.shop.controller;

import lombok.RequiredArgsConstructor;
import net.wanho.shop.entity.Orders;
import net.wanho.shop.service.OrdersService;
import net.wanho.shop.vo.Page;
import net.wanho.shop.vo.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Author：汤小洋
 * Date：2025-09-24 13:48
 * Description：<描述>
 */
@RestController
@RequestMapping("/orders")
@RequiredArgsConstructor
public class OrdersController {

    private final OrdersService ordersService;

    @GetMapping("/page")
    public R findPage(@RequestParam(required = false, defaultValue = "1") Integer pageNum,
                      @RequestParam(required = false, defaultValue = "10") Integer pageSize,
                      Orders orders) {
        Page<Orders> page = ordersService.findPage(pageNum, pageSize, orders);
        return R.success(page);
    }

}
